<%--
  Created by IntelliJ IDEA.
  User: 李小清
  Date: 2025/5/13
  Time: 11:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
  <title>添加订单</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f4f4f4;
      margin: 0;
      padding: 0;
    }
    .container {
      max-width: 800px;
      margin: 50px auto;
      padding: 20px;
      background-color: #fff;
      border-radius: 8px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    }
    h1 {
      color: #28a745;
    }
    .form-group {
      margin-bottom: 20px;
    }
    .form-group label {
      display: block;
      margin-bottom: 5px;
    }
    .form-group select, .form-group input {
      width: 100%;
      padding: 10px;
      border: 1px solid #ccc;
      border-radius: 4px;
    }
    .button {
      display: inline-block;
      padding: 10px 20px;
      font-size: 16px;
      color: #fff;
      background-color: #28a745;
      border: none;
      border-radius: 5px;
      text-decoration: none;
      cursor: pointer;
    }
    .button:hover {
      background-color: #218838;
    }
  </style>
</head>
<body>
<div class="container">
  <h1>添加订单</h1>
  <form action="${pageContext.request.contextPath}/order/order_submit" method="post">
    <div class="form-group">
      <label for="address">选择地址：
      <a href="${pageContext.request.contextPath}/address/list">没有地址，点击去添加</a></label>
      <select name="address" id="address">
        <c:forEach items="${addresses}" var="address">
          <option value="${address.id}">${address.address}+${address.phone}</option>
        </c:forEach>
      </select>
    </div>
    <div class="form-group">
      <label for="payType">支付方式：</label>
      <select name="payType" id="payType">
        <option value="微信支付">微信支付</option>
        <option value="支付宝">支付宝</option>
        <option value="现金支付">现金支付</option>
      </select>
    </div>
    <div class="form-group">
      <label>购物车商品：</label>
<%--      <c:forEach items="${cartItems}" var="item">--%>
       <input type="hidden" name="itemId" value="${cartItems.goodid}" />
       <input type="hidden" name="goodprice" value="${cartItems.goodprice}" />
        <input type="hidden" name="cartId" value="${cartItems.id}">
        <p>${cartItems.goodname} - 数量: ${cartItems.num} - 单价: ${cartItems.goodprice}</p>
<%--      </c:forEach>--%>
    </div>
    <div class="form-group">
      <label>总价：</label>
      <p id="total">${cartItems.goodprice}</p>
    </div>
    <button type="submit" class="button">提交订单</button>
  </form>
</div>
</body>
</html>
